home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Technology Seed / ADC Seed CD - July 1999.toast / USB / Mac OS USB DDK v1.2 / Examples / MouseModule / MouseModule.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-04-15  |  2.4 KB  |  89 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        MouseModule.h
  3.  
  4.     Contains:    Header file for mouse module
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1997-1999 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11. #ifndef __MouseModuleH__
  12. #define __MouseModuleH__
  13.  
  14. #include <Types.h>
  15. #include <Devices.h>
  16. #include <DriverServices.h>
  17. #include <Processes.h>
  18. #include <CursorDevices.h>
  19. #include <USB.h>
  20.  
  21. #define kMouseModuleName    "\pUSBHIDMouseModule"
  22.  
  23. Boolean    immediateError(OSStatus err);
  24. void     InitParamBlock(USBReference theInterfaceRef, USBPB * paramblock);
  25. void     MouseInitiateTransaction(USBPB *pb);
  26. void     MouseCompletionProc(USBPB *pb);
  27. void    InterfaceEntry(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterfaceDescriptor, USBDeviceDescriptorPtr pDeviceDescriptor, USBDeviceRef device);
  28.  
  29. static     OSStatus    MouseDeviceInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
  30. static     OSStatus    MouseInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
  31. static     OSStatus    MouseModuleFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
  32.  
  33. OSStatus USBHIDControlDevice(UInt32 theControlSelector, void * theControlData);
  34. void NotifyRegisteredHIDUser(UInt32 refcon, UInt32 reportSize, void * theReport, USBReference theInterfaceRef);
  35.  
  36. void     USBMouseIn(UInt32 refcon, void * theData);
  37.  
  38. #define kMouseRetryCount    3
  39.  
  40. enum driverstages
  41. {  
  42.     kUndefined = 0,
  43.     kSetProtocol,
  44.     kSetIdleRequest,
  45.     kConfigureInterface,
  46.     kFindPipe,
  47.     kReadInterruptPipe,
  48.     kClearFeature,
  49.     kReturnFromDriver =     0x1000,
  50.     kRetryTransaction =     0x2000,
  51.     kSyncTransaction =         0x4000,
  52.     kCompletionPending =     0x8000
  53. };
  54.  
  55. typedef struct
  56. {
  57.     USBPB                             pb;
  58.     void (*handler)(USBPB             *pb);
  59.     
  60.     Boolean                            intPipeAborted;
  61.     Boolean                            driverRemovalPending;
  62.  
  63.     USBReference                    interfaceRef;
  64.     USBPipeRef                        pipeRef;
  65.     
  66.     USBDeviceDescriptor             deviceDescriptor;
  67.     USBInterfaceDescriptor            interfaceDescriptor;
  68.  
  69.     UInt32                            hidDeviceType;
  70.     UInt8                            hidReport[64];
  71.     UInt32                            maxPacketSize;
  72.     
  73.     HIDInterruptProcPtr             pSHIMInterruptRoutine;
  74.     HIDInterruptProcPtr             pSavedInterruptRoutine;
  75.     
  76.     UInt32                            interruptRefcon;
  77.     
  78.     HIDNotificationProcPtr             pNotificationRoutine;
  79.     UInt32                            notificationRefcon;
  80.     
  81.     SInt32                             retryCount;
  82.     SInt32                            transDepth;
  83.     
  84.     CursorDevicePtr                    pCursorDeviceInfo;
  85.     CursorDevice                    cursorDeviceInfo;
  86.     Fixed                            unitsPerInch;
  87. } usbMousePBStruct;
  88.  
  89. #endif //__MouseModuleH__